  <script type="text/javascript">

    //调用微信JS api 支付
    function jsApiCall()
    {
      WeixinJSBridge.invoke(
        'getBrandWCPayRequest',
        <?php echo $jsApiParameters; ?>,
        function(res){
          WeixinJSBridge.log(res.err_msg);
          //alert(res.err_code+res.err_desc+res.err_msg);
          if(res.err_msg=="get_brand_wcpay_request:ok"){
            location.href = "<?php echo $redirect; ?>";
          }
        }
      );
    }

    function callpay()
    {
      if (typeof WeixinJSBridge == "undefined"){
          if( document.addEventListener ){
              document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
          }else if (document.attachEvent){
              document.attachEvent('WeixinJSBridgeReady', jsApiCall); 
              document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
          }
      }else{
          jsApiCall();
      }
    }
  </script>
  <div class="pull-right">
    <input type="button" onclick="callpay()" value="<?php echo $button_confirm; ?>" id="button-confirm" class="btn btn-primary" />
  </div>
  